package com.huatai.datacenter.controller;

import com.huatai.common.api.R;
import com.huatai.datacenter.entity.Index.IndexRateVO;
import com.huatai.datacenter.entity.Index.IndexUseageVO;
import com.huatai.datacenter.entity.Index.IndexValuesVO;
import com.huatai.datacenter.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author gusiyi
 * @version 1.0
 * @className IndexController
 * @description 描述：数据中台首页统计图controller
 * @date 2023/7/18 14:05
 */

@RequestMapping("/index")
@RestController
@Api(value = "首页统计", tags = "首页统计")
public class IndexController {

	@Autowired
	private IndexService indexService;


	@RequestMapping("/getUseageInfo")
	@ApiOperation("获取使用情况数据")
	public R<List<IndexUseageVO>> getUseageInfo(){
		List<IndexUseageVO> useageList = indexService.getUseageInfo();
		return R.data(useageList);
	}

	@RequestMapping("/getDataSourceRate")
	@ApiOperation("获取饼图数据占比")
	public R<IndexRateVO> getDataSourceRate(@RequestParam("type") String type){
		return R.data(indexService.getRateData(type));
	}

	@RequestMapping("/getServiceInfo")
	@ApiOperation("获取服务数据")
	public R<List<IndexValuesVO>> getServiceInfo(){
		return R.data(indexService.getServiceInfo());
	}
}
